package cj.web.portal.dao;

import java.util.List;
import java.util.Map;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

@DAO
public interface ResDAO {
	
	//列表
	@SQL("SELECT id,title,category,abstractInfor,carouselImage,releaseAT FROM Resources WHERE deleteFlag=1 #if(:1!=''){AND category = :1 } ORDER BY updateAT DESC LIMIT :2,:3 ")
    List<Map> query(String category,int start,int length);	
	
	//列表Size
	@SQL("SELECT count(1) FROM Resources WHERE deleteFlag=1 #if(:1!=''){AND category = :1 } ORDER BY updateAT DESC")
    int queryCount(String category);
	
	//详情
	@SQL("SELECT id,title,category,abstractInfor,carouselImage,content,author,releaseState,releaseAT FROM Resources WHERE deleteFlag=1 AND id = :1 ")
    List<Map> queryById(String id);

	//类型查询列表(大事记时间轴)
	@SQL("SELECT id,title,category,abstractInfor,carouselImage,content,author,releaseState,releaseAT FROM Resources WHERE deleteFlag=1 AND category = :1 ORDER BY title DESC,abstractInfor desc")
    List<Map> queryByCategory(String category);	
	
	//标题查询详情(大事记详情)
	@SQL("SELECT id,title,category,abstractInfor,carouselImage,content,author,releaseState,releaseAT FROM Resources WHERE deleteFlag=1 AND category = :1 AND title like '%##(:2)%' ")
	List<Map> queryByTitle(String Category, String title);

}
